import store from "./store";
import { increment, decrement } from './store/actions'
// 目标：用 Redux 来操作数据
const App = () => {
  return (
    <div>
      <h3>{store.getState()}</h3>
      <div>
        {/* 通过 store 实例派发（dispatch）action，通知 reducer 执行，reducer 执行后会把处理完后的结果给 store */}
        {/* 通过调用 actionCreator => increment 生成了一个 action */}
        <button onClick={() => store.dispatch(increment(1))}>+1</button>
        <button onClick={() => store.dispatch(increment(5))}>+5</button>
        <button onClick={() => store.dispatch(decrement(5))}>-5</button>
        <button onClick={() => store.dispatch(decrement(1))}>-1</button>
      </div>
    </div>
  )
}
export default App